@@ -1,5 +1,73 @@
Revision history for Perl module CPAN::Reporter
+1.2002 2011-08-10 17:52:08 America/New_York
+
+ [BUG FIXES]
+
+ - Fix failing tests on systems without
+ Test::Reporter::Transport::Metabase
+ - Minor test cleanups for use with 'prove'
+
+1.2001 2011-08-07 05:05:58 America/New_York
+
+ [BUG FIXES]
+
+ - Fix failing test on Windows due to glob expansion of "~"
+ [Christian Walde]
+
+1.20 2011-08-05 13:17:20 America/New_York
+
+ [BUG FIXES]
+
+ - Removed Test::Reporter::Transport::Metabase as a prerequisite.
+ New testers are recommended to install Task::CPAN::Reporter instead
+ of CPAN::Reporter.
+
+1.19_04 2011-06-29 17:39:25 America/New_York
+
+ [NEW FEATURES]
+
+ - Metabase profile generation will use as much of the provided
+ email_from parameter as possible and will generate a random
+ secret API key. If user provides email_from in a standard form
+ like C<< "John Q. Public" <jqp@example.com> >> then profile
+ generation is entirely automatic without additional prompts
+ from metabase-profile [David Golden]
+
+ [DOCUMENTATION]
+
+ - Swapped in Task::CPAN::Reporter in the SYNOPSIS [David Golden]
+
+ [BUG FIXES]
+
+ - Expands "~" into user directory before attempting to locate
+ 'relative' pathname in .cpanreporter directory [David Golden]
+
+1.19_03 2011-06-28 14:44:19 America/New_York
+
+ [NEW FEATURES]
+ - During configuration, if 'Metabase' is the requested transport and
+ a Metabase profile file is not found, configuration will offer to
+ run metabase-profile to create it. [David Golden]
+
+ - For Metabase transport (only), the 'id_file' may have a relative
+ file path, treated as relative to the .cpanreporter directory.
+ [David Golden]
+
+ [BUG FIXES]
+ - updated CPAN::Reporter to go with Metabase by default, instead of
+ the deprecated SMTP transport system. This provides more up-to-date
+ information for new testers on how to setup their systems and
+ addresses RT#64316 (and maybe also RT#61735) [Breno G. de Oliveira]
+
+ - Replaced use of Tee.pm with Capture::Tiny as the two don't play
+ well together on some systems. [Christian Walde]
+
+ [DOCUMENTATION]
+ - Docs have been substantially re-written to reflect the new HTTP-based
+ transport instead of email-based transport. [Breno G. de Oliveira and
+ David Golden]
+
1.1902 2011-01-28 15:22:35 EST5EDT
[BUG FIXES]
@@ -6,6 +6,7 @@ META.json
META.yml
Makefile.PL
README
+README.PATCHING
Todo
dist.ini
examples/config.ini
@@ -82,3 +83,4 @@ xt/release/distmeta.t
xt/release/pod-coverage.t
xt/release/pod-syntax.t
xt/release/portability.t
+xt/release/test-version.t
@@ -4,7 +4,7 @@
"David Golden <dagolden@cpan.org>"
],
"dynamic_config" : 0,
- "generated_by" : "Dist::Zilla version 4.200001, CPAN::Meta::Converter version 2.102400",
+ "generated_by" : "Dist::Zilla version 4.200012, CPAN::Meta::Converter version 2.110930",
"license" : [
"apache_2_0"
],
@@ -27,7 +27,7 @@
"prereqs" : {
"configure" : {
"requires" : {
- "ExtUtils::MakeMaker" : "6.31"
+ "ExtUtils::MakeMaker" : "6.30"
}
},
"runtime" : {
@@ -44,14 +44,15 @@
"Fcntl" : 0,
"File::Basename" : 0,
"File::Find" : 0,
+ "File::Glob" : 0,
"File::HomeDir" : "0.58",
"File::Path" : 0,
"File::Spec" : "3.19",
"File::Temp" : "0.16",
"IO::File" : 0,
+ "IPC::Cmd" : "0.46",
"Parse::CPAN::Meta" : 0,
"Probe::Perl" : 0,
- "Tee" : "0.14",
"Test::Reporter" : "1.54",
"constant" : 0,
"perl" : "5.006",
@@ -73,38 +74,42 @@
"provides" : {
"CPAN::Reporter" : {
"file" : "lib/CPAN/Reporter.pm",
- "version" : "1.1902"
+ "version" : "1.2002"
},
"CPAN::Reporter::API" : {
"file" : "lib/CPAN/Reporter/API.pm",
- "version" : "1.1902"
+ "version" : "1.2002"
},
"CPAN::Reporter::Config" : {
"file" : "lib/CPAN/Reporter/Config.pm",
- "version" : "1.1902"
+ "version" : "1.2002"
},
"CPAN::Reporter::FAQ" : {
"file" : "lib/CPAN/Reporter/FAQ.pm",
- "version" : "1.1902"
+ "version" : "1.2002"
},
"CPAN::Reporter::History" : {
"file" : "lib/CPAN/Reporter/History.pm",
- "version" : "1.1902"
+ "version" : "1.2002"
},
"CPAN::Reporter::PrereqCheck" : {
"file" : "lib/CPAN/Reporter/PrereqCheck.pm",
- "version" : "1.1902"
+ "version" : "1.2002"
}
},
"release_status" : "stable",
"resources" : {
- "homepage" : "http://github.com/dagolden/cpan-reporter/tree",
+ "bugtracker" : {
+ "mailto" : "bug-cpan-reporter at rt.cpan.org",
+ "web" : "http://rt.cpan.org/Public/Dist/Display.html?Name=CPAN-Reporter"
+ },
+ "homepage" : "http://github.com/dagolden/cpan-reporter",
"repository" : {
"type" : "git",
- "url" : "git://github.com/dagolden/cpan-reporter.git",
- "web" : "http://github.com/dagolden/cpan-reporter/tree"
+ "url" : "http://github.com/dagolden/cpan-reporter",
+ "web" : "http://github.com/dagolden/cpan-reporter"
}
},
- "version" : "1.1902"
+ "version" : "1.2002"
}
@@ -11,9 +11,9 @@ build_requires:
Test::Harness: 0
Test::More: 0.62
configure_requires:
- ExtUtils::MakeMaker: 6.31
+ ExtUtils::MakeMaker: 6.30
dynamic_config: 0
-generated_by: 'Dist::Zilla version 4.200001, CPAN::Meta::Converter version 2.102400'
+generated_by: 'Dist::Zilla version 4.200012, CPAN::Meta::Converter version 2.110930'
license: apache
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
@@ -30,22 +30,22 @@ no_index:
provides:
CPAN::Reporter:
file: lib/CPAN/Reporter.pm
- version: 1.1902
+ version: 1.2002
CPAN::Reporter::API:
file: lib/CPAN/Reporter/API.pm
- version: 1.1902
+ version: 1.2002
CPAN::Reporter::Config:
file: lib/CPAN/Reporter/Config.pm
- version: 1.1902
+ version: 1.2002
CPAN::Reporter::FAQ:
file: lib/CPAN/Reporter/FAQ.pm
- version: 1.1902
+ version: 1.2002
CPAN::Reporter::History:
file: lib/CPAN/Reporter/History.pm
- version: 1.1902
+ version: 1.2002
CPAN::Reporter::PrereqCheck:
file: lib/CPAN/Reporter/PrereqCheck.pm
- version: 1.1902
+ version: 1.2002
requires:
CPAN: 1.9301
CPAN::Version: 0
@@ -59,19 +59,21 @@ requires:
Fcntl: 0
File::Basename: 0
File::Find: 0
+ File::Glob: 0
File::HomeDir: 0.58
File::Path: 0
File::Spec: 3.19
File::Temp: 0.16
IO::File: 0
+ IPC::Cmd: 0.46
Parse::CPAN::Meta: 0
Probe::Perl: 0
- Tee: 0.14
Test::Reporter: 1.54
constant: 0
perl: 5.006
vars: 0
resources:
- homepage: http://github.com/dagolden/cpan-reporter/tree
- repository: git://github.com/dagolden/cpan-reporter.git
-version: 1.1902
+ bugtracker: http://rt.cpan.org/Public/Dist/Display.html?Name=CPAN-Reporter
+ homepage: http://github.com/dagolden/cpan-reporter
+ repository: http://github.com/dagolden/cpan-reporter
+version: 1.2002
@@ -2,9 +2,9 @@
use strict;
use warnings;
-BEGIN { require 5.006; }
+use 5.006;
-use ExtUtils::MakeMaker 6.31;
+use ExtUtils::MakeMaker 6.30;
@@ -21,7 +21,7 @@ my %WriteMakefileArgs = (
'Test::More' => '0.62'
},
'CONFIGURE_REQUIRES' => {
- 'ExtUtils::MakeMaker' => '6.31'
+ 'ExtUtils::MakeMaker' => '6.30'
},
'DISTNAME' => 'CPAN-Reporter',
'EXE_FILES' => [],
@@ -40,19 +40,20 @@ my %WriteMakefileArgs = (
'Fcntl' => '0',
'File::Basename' => '0',
'File::Find' => '0',
+ 'File::Glob' => '0',
'File::HomeDir' => '0.58',
'File::Path' => '0',
'File::Spec' => '3.19',
'File::Temp' => '0.16',
'IO::File' => '0',
+ 'IPC::Cmd' => '0.46',
'Parse::CPAN::Meta' => '0',
'Probe::Perl' => '0',
- 'Tee' => '0.14',
'Test::Reporter' => '1.54',
'constant' => '0',
'vars' => '0'
},
- 'VERSION' => '1.1902',
+ 'VERSION' => '1.2002',
'test' => {
'TESTS' => 't/*.t'
}
@@ -2,15 +2,21 @@ NAME
CPAN::Reporter - Adds CPAN Testers reporting to CPAN.pm
VERSION
- version 1.1902
+ version 1.2002
SYNOPSIS
From the CPAN shell:
- cpan> install CPAN::Reporter
+ cpan> install Task::CPAN::Reporter
cpan> reload cpan
cpan> o conf init test_report
+ Installing Task::CPAN::Reporter will pull in additional dependencies
+ that new CPAN Testers will need.
+
+ Advanced CPAN Testers with custom Test::Reporter::Transport setups may
+ wish to install only CPAN::Reporter, which has fewer dependencies.
+
DESCRIPTION
The CPAN Testers project captures and analyses detailed results from
building and testing CPAN distributions on multiple operating systems
@@ -55,14 +61,12 @@ GETTING STARTED
John Doe <johndoe@example.com>
"John Q. Public" <johnqpublic@example.com>
- Users will also be prompted to enter the name of an outbound email
- server. It is recommended to use an email server provided by the user's
- ISP or company. Alternatively, leave this blank to attempt to send email
- directly to perl.org.
-
Users that are new to CPAN::Reporter should accept the recommended
values for other configuration options.
+ Users will be prompted to create a *Metabase profile* file that uniquely
+ identifies their test reports. See "The Metabase" below for details.
+
After completing interactive configuration, be sure to commit (save) the
CPAN configuration changes.
@@ -70,17 +74,32 @@ GETTING STARTED
See CPAN::Reporter::Config for advanced configuration settings.
+ The Metabase
+ CPAN::Reporter sends test reports to a server known as the Metabase.
+ This requires an active Internet connection and a profile file. To
+ create the profile, users will need to run "metabase-profile" from a
+ terminal window and fill the information at the prompts. This will
+ create a file called "metabase_id.json" in the current directory. That
+ file should be moved to the ".cpanreporter" directory inside the user's
+ home dir.
+
+ Users with an existing metabase profile file (e.g. from another
+ machine), should copy it into the ".cpanreporter" directory instead of
+ creating a new one. Profile files may be located outside the
+ ".cpanreporter" directory by following instructions in
+ CPAN::Reporter::Config.
+
Using CPAN::Reporter
Once CPAN::Reporter is enabled and configured, test or install modules
with CPAN.pm as usual.
- For example, to force CPAN to repeat tests for CPAN::Reporter to see how
- it works:
+ For example, to test the File::Marker module:
- cpan> force test CPAN::Reporter
+ cpan> test File::Marker
- When distribution tests fail, users will be prompted to edit the report
- to add addition information.
+ If a distribution's tests fail, users will be prompted to edit the
+ report to add additional information that might help the author
+ understand the failure.
UNDERSTANDING TEST GRADES
CPAN::Reporter will assign one of the following grades to the report:
@@ -147,6 +166,22 @@ SEE ALSO
* CPAN::Reporter::FAQ -- hints and tips
+SUPPORT
+ Bugs / Feature Requests
+ Please report any bugs or feature requests by email to
+ "bug-cpan-reporter at rt.cpan.org", or through the web interface at
+ <http://rt.cpan.org/Public/Dist/Display.html?Name=CPAN-Reporter>. You
+ will be automatically notified of any progress on the request by the
+ system.
+
+ Source Code
+ This is open source software. The code repository is available for
+ public review and contribution under the terms of the license.
+
+ <http://github.com/dagolden/cpan-reporter>
+
+ git clone http://github.com/dagolden/cpan-reporter
+
AUTHOR
David Golden <dagolden@cpan.org>
@@ -0,0 +1,42 @@
+README.PATCHING
+
+Thank you for considering contributing to this distribution. This file
+contains instructions that will help you work with the source code.
+
+The distribution is managed with Dist::Zilla. This means than many of the
+usual files you might expect are not in the repository, but are generated
+at release time (e.g. Makefile.PL).
+
+However, you can run tests directly using the 'prove' tool:
+
+ $ prove -l
+ $ prove -lv t/some_test_file.t
+
+For most distributions, 'prove' is entirely sufficent for you to test any
+patches you have.
+
+Likewise, much of the documentation Pod is generated at release time.
+Depending on the distribution, some documentation may be written in a Pod
+dialect called WikiDoc. (See Pod::WikiDoc on CPAN.) If you would like to
+submit a documentation edit, please limit yourself to the documentation you
+see.
+
+If you see typos or documentation issues in the generated docs, please
+email or open a bug ticket instead of patching.
+
+Dist::Zilla is a very powerful authoring tool, but requires a number of
+author-specific plugins. If you would like to use it for contributing,
+install it from CPAN, then run one of the following commands, depending on
+your CPAN client:
+
+ $ cpan `dzil authordeps`
+ $ dzil authordeps | cpanm
+
+Once installed, here are some dzil commands you might try:
+
+ $ dzil build
+ $ dzil test
+ $ dzil xtest
+
+You can learn more about Dist::Zilla at http://dzil.org/
+
@@ -5,7 +5,7 @@ copyright_holder = David Golden
copyright_year = 2006
[@DAGOLDEN]
-git_remote = github
+:version = 0.019
[RemovePrereqs]
remove = FuddleDuddleCantFindMe
@@ -1,23 +1,12 @@
-#
-# This file is part of CPAN-Reporter
-#
-# This software is Copyright (c) 2006 by David Golden.
-#
-# This is free software, licensed under:
-#
-# The Apache License, Version 2.0, January 2004
-#
use strict; # make CPANTS happy
package CPAN::Reporter::API;
-BEGIN {
- $CPAN::Reporter::API::VERSION = '1.1902';
-}
-# ABSTRACT: Programmer's interface to CPAN::Reporter
+our $VERSION = '1.2002'; # VERSION
-# Not really a .pm file, but holds wikidoc which will be
-# turned into .pod by the Build.PL
1;
+# ABSTRACT: Programmer's interface to CPAN::Reporter
+
+
=pod
@@ -27,7 +16,7 @@ CPAN::Reporter::API - Programmer's interface to CPAN::Reporter
=head1 VERSION
-version 1.1902
+version 1.2002
=head1 FUNCTIONS
@@ -1,23 +1,13 @@
-#
-# This file is part of CPAN-Reporter
-#
-# This software is Copyright (c) 2006 by David Golden.
-#
-# This is free software, licensed under:
-#
-# The Apache License, Version 2.0, January 2004
-#
-use strict;
+use strict;
package CPAN::Reporter::Config;
-BEGIN {
- $CPAN::Reporter::Config::VERSION = '1.1902';
-}
-# ABSTRACT: Config file options for CPAN::Reporter
+our $VERSION = '1.2002'; # VERSION
use Config::Tiny 2.08 ();
-use File::HomeDir 0.58 ();
-use File::Path (qw/mkpath/);
+use File::Glob ();
+use File::HomeDir 0.58 ();
+use File::Path qw/mkpath/;
use File::Spec 3.19 ();
+use IPC::Cmd 0.46 ();
use IO::File ();
use CPAN 1.9301 (); # for printing warnings
@@ -32,11 +22,11 @@ if ( $^O eq 'darwin' ) {
my $new = File::Spec->catdir(File::HomeDir->my_home,".cpanreporter");
if ( ( -d $old ) && (! -d $new ) ) {
$CPAN::Frontend->mywarn( << "HERE");
-CPAN::Reporter: since CPAN::Reporter 0.28_51, the Mac OSX config directory
-has changed.
+CPAN::Reporter: since CPAN::Reporter 0.28_51, the Mac OSX config directory
+has changed.
Old: $old
- New: $new
+ New: $new
Your existing configuration file will be moved automatically.
HERE
@@ -62,7 +52,7 @@ HERE
sub _configure {
my $config_dir = _get_config_dir();
my $config_file = _get_config_file();
-
+
mkpath $config_dir if ! -d $config_dir;
if ( ! -d $config_dir ) {
$CPAN::Frontend->myprint(
@@ -73,10 +63,10 @@ sub _configure {
my $config;
my $existing_options;
-
+
# explain grade:action pairs
$CPAN::Frontend->myprint( _grade_action_prompt() );
-
+
# read or create
if ( -f $config_file ) {
$CPAN::Frontend->myprint(
@@ -101,7 +91,7 @@ sub _configure {
);
$config = Config::Tiny->new();
}
-
+
my %spec = _config_spec();
for my $k ( _config_order() ) {
@@ -117,14 +107,14 @@ sub _configure {
}
# repeat until validated
PROMPT:
- while ( defined (
+ while ( defined (
my $answer = CPAN::Shell::colorable_makemaker_prompt(
- "$k?",
- $existing_options->{$k} || $option_data->{default}
+ "$k?",
+ $existing_options->{$k} || $option_data->{default}
)
)) {
if ( ! $option_data->{validate} ||
- $option_data->{validate}->($k, $answer)
+ $option_data->{validate}->($k, $answer, $config->{_})
) {
$config->{_}{$k} = $answer;
last PROMPT;
@@ -133,12 +123,12 @@ sub _configure {
}
else {
# only initialize options without default if
- # answer matches non white space and validates,
+ # answer matches non white space and validates,
# otherwise reset it
- my $answer = CPAN::Shell::colorable_makemaker_prompt(
- "$k?",
- $existing_options->{$k} || q{}
- );
+ my $answer = CPAN::Shell::colorable_makemaker_prompt(
+ "$k?",
+ $existing_options->{$k} || q{}
+ );
if ( $answer =~ /\S/ ) {
$config->{_}{$k} = $answer;
}
@@ -155,19 +145,19 @@ sub _configure {
"\nYour CPAN::Reporter config file also contains these advanced " .
"options:\n\n") if keys %$existing_options;
for my $k ( keys %$existing_options ) {
- $config->{_}{$k} = CPAN::Shell::colorable_makemaker_prompt(
- "$k?", $existing_options->{$k}
- );
+ $config->{_}{$k} = CPAN::Shell::colorable_makemaker_prompt(
+ "$k?", $existing_options->{$k}
+ );
}
- $CPAN::Frontend->myprint(
+ $CPAN::Frontend->myprint(
"\nCPAN::Reporter: writing config file to '$config_file'.\n"
);
if ( $config->write( $config_file ) ) {
return $config->{_};
}
else {
- $CPAN::Frontend->mywarn( "\nCPAN::Reporter: error writing config file to '$config_file':\n"
+ $CPAN::Frontend->mywarn( "\nCPAN::Reporter: error writing config file to '$config_file':\n"
. Config::Tiny->errstr(). "\n");
return;
}
@@ -178,16 +168,16 @@ sub _configure {
#--------------------------------------------------------------------------#
#--------------------------------------------------------------------------#
-# _config_order -- determines order of interactive config. Only items
+# _config_order -- determines order of interactive config. Only items
# in interactive config will be written to a starter config file
#--------------------------------------------------------------------------#
sub _config_order {
- return qw(
- email_from
- smtp_server
- edit_report
+ return qw(
+ email_from
+ edit_report
send_report
+ transport
);
}
@@ -205,37 +195,26 @@ sub _config_order {
my %option_specs = (
email_from => {
default => '',
- prompt => 'What email address will be used for sending reports?',
+ prompt => 'What email address will be used to reference your reports?',
info => <<'HERE',
-CPAN::Reporter requires a valid email address as the return address
-for test reports sent to cpan-testers\@perl.org. Either provide just
-an email address, or put your real name in double-quote marks followed
-by your email address in angle marks, e.g. "John Doe" <jdoe@nowhere.com>.
-Note: unless this email address is subscribed to the cpan-testers mailing
-list, your test reports will not appear until manually reviewed.
+CPAN::Reporter requires a valid email address to identify senders
+in the body of a test report. Please use a standard email format
+like: "John Doe" <jdoe@example.com>
HERE
},
smtp_server => {
- default => undef, # optional
- info => <<'HERE',
-If your computer is behind a firewall or your ISP blocks
-outbound mail traffic, CPAN::Reporter will not be able to send
-test reports unless you provide an alternate outbound (SMTP)
-email server. Enter the full name of your outbound mail server
-(e.g. smtp.your-ISP.com) or leave this blank to send mail
-directly to perl.org. Use a space character to reset this value
-to sending to perl.org.
-HERE
+ default => undef, # (deprecated)
+ prompt => "[DEPRECATED] It's safe to remove this from your config file.",
},
edit_report => {
default => 'default:ask/no pass/na:no',
prompt => "Do you want to review or edit the test report?",
validate => \&_validate_grade_action_pair,
info => <<'HERE',
-Before test reports are sent, you may want to review or edit the test
-report and add additional comments about the result or about your system
+Before test reports are sent, you may want to review or edit the test
+report and add additional comments about the result or about your system
or Perl configuration. By default, CPAN::Reporter will ask after
-each report is generated whether or not you would like to edit the
+each report is generated whether or not you would like to edit the
report. This option takes "grade:action" pairs.
HERE
},
@@ -245,10 +224,22 @@ HERE
validate => \&_validate_grade_action_pair,
info => <<'HERE',
By default, CPAN::Reporter will prompt you for confirmation that
-the test report should be sent before actually emailing the
-report. This gives the opportunity to bypass sending particular
-reports if you need to (e.g. if you caused the failure).
-This option takes "grade:action" pairs.
+the test report should be sent before actually doing it. This
+gives the opportunity to skip sending particular reports if
+you need to (e.g. if you caused the failure). This option takes
+"grade:action" pairs.
+HERE
+ },
+ transport => {
+ default => 'Metabase uri https://metabase.cpantesters.org/api/v1/ id_file metabase_id.json',
+ prompt => 'Which transport system will be used to transmit the reports?',
+ validate => \&_validate_transport,
+ info => <<'HERE',
+CPAN::Reporter sends your reports over HTTPS using Metabase. This option lets
+you set a different uri, transport mechanism and metabase profile path. If you
+are receiving HTTPS errors, you may change the uri to use plain HTTP, though
+this is not recommended. Unless you know what you're doing, just accept
+the default value.
HERE
},
send_duplicates => {
@@ -258,13 +249,13 @@ HERE
info => <<'HERE',
CPAN::Reporter records tests grades for each distribution, version and
platform. By default, duplicates of previous results will not be sent at
-all, regardless of the value of the "send_report" option. This option takes
+all, regardless of the value of the "send_report" option. This option takes
"grade:action" pairs.
HERE
},
send_PL_report => {
prompt => "Do you want to send the PL report?",
- default => undef,
+ default => undef,
validate => \&_validate_grade_action_pair,
},
send_make_report => {
@@ -298,9 +289,6 @@ HERE
editor => {
default => undef,
},
- transport => {
- default => undef,
- },
debug => {
default => undef,
},
@@ -309,12 +297,51 @@ HERE
sub _config_spec { return %option_specs }
#--------------------------------------------------------------------------#
+# _generate_profile
+#
+# Run 'metabase-profile' in the .cpanreporter directory
+#--------------------------------------------------------------------------#
+
+sub _generate_profile {
+ my ($id_file, $config) = @_;
+
+ my $cmd = IPC::Cmd::can_run('metabase-profile');
+ return unless $cmd;
+
+ # XXX this is an evil assumption about email addresses, but
+ # might do for simple cases that users might actually provide
+
+ my @opts = ("--output" => $id_file);
+ my $email = $config->{email_from};
+
+ if ($email =~ /\A(.+)\s+<([^>]+)>\z/ ) {
+ push @opts, "--email" => $2;
+ my $name = $1;
+ $name =~ s/\A["'](.*)["']\z/$1/;
+ push ( @opts, "--name" => $1)
+ if length $name;
+ }
+ else {
+ push @opts, "--email" => $email;
+ }
+
+ # XXX profile 'secret' is really just a generated API key, so we
+ # can create something fairly random for the user and use that
+ push @opts, "--secret" => sprintf("%08x", rand(2**31));
+
+ return scalar IPC::Cmd::run(
+ command => [ $cmd, @opts ],
+ verbose => 1,
+ );
+}
+
+#--------------------------------------------------------------------------#
# _get_config_dir
#--------------------------------------------------------------------------#
sub _get_config_dir {
- if ( defined $ENV{PERL_CPAN_REPORTER_DIR} &&
- length $ENV{PERL_CPAN_REPORTER_DIR}
+ if ( defined $ENV{PERL_CPAN_REPORTER_DIR} &&
+ length $ENV{PERL_CPAN_REPORTER_DIR}
) {
return $ENV{PERL_CPAN_REPORTER_DIR};
}
@@ -335,7 +362,7 @@ sub _get_config_dir {
sub _get_config_file {
if ( defined $ENV{PERL_CPAN_REPORTER_CONFIG} &&
- length $ENV{PERL_CPAN_REPORTER_CONFIG}
+ length $ENV{PERL_CPAN_REPORTER_CONFIG}
) {
return $ENV{PERL_CPAN_REPORTER_CONFIG};
}
@@ -386,12 +413,12 @@ pairs that determine what grade-specific action to take for that option.
These pairs should be space-separated and are processed left-to-right. See
CPAN::Reporter documentation for more details.
- GRADE : ACTION ======> EXAMPLES
- ------- ------- --------
+ GRADE : ACTION ======> EXAMPLES
+ ------- ------- --------
pass yes default:no
fail no default:yes pass:no
unknown ask/no default:ask/no pass:yes fail:no
- na ask/yes
+ na ask/yes
default
HERE
@@ -417,6 +444,25 @@ sub _is_valid_grade {
return grep { $grade eq $_ } @valid_grades;
}
+
+#--------------------------------------------------------------------------#
+# _normalize_id_file
+#--------------------------------------------------------------------------#
+
+sub _normalize_id_file {
+ my ($id_file) = @_;
+
+ if ( $id_file =~ /~/ ) {
+ $id_file = File::Glob::bsd_glob( $id_file );
+ }
+ unless ( File::Spec->file_name_is_absolute( $id_file ) ) {
+ $id_file = File::Spec->catfile(
+ CPAN::Reporter::Config::_get_config_dir(), $id_file
+ );
+ }
+ return $id_file;
+}
+
#--------------------------------------------------------------------------#
# _open_config_file
#--------------------------------------------------------------------------#
@@ -426,7 +472,7 @@ sub _open_config_file {
my $config = Config::Tiny->read( $config_file )
or $CPAN::Frontend->mywarn("CPAN::Reporter: couldn't read configuration file " .
"'$config_file': \n" . Config::Tiny->errstr() . "\n");
- return $config;
+ return $config;
}
#--------------------------------------------------------------------------#
@@ -442,8 +488,8 @@ sub _validate {
}
#--------------------------------------------------------------------------#
-# _validate_grade_action
-# returns hash of grade => action
+# _validate_grade_action
+# returns hash of grade => action
# returns undef
#--------------------------------------------------------------------------#
@@ -452,7 +498,7 @@ sub _validate_grade_action_pair {
$option ||= "no";
my %ga_map; # grade => action
-
+
PAIR: for my $grade_action ( split q{ }, $option ) {
my ($grade_list,$action);
@@ -477,27 +523,27 @@ sub _validate_grade_action_pair {
}
else {
# something weird, so warn and skip
- $CPAN::Frontend->mywarn(
- "\nCPAN::Reporter: ignoring invalid grade:action '$grade_action' for '$name'.\n\n"
+ $CPAN::Frontend->mywarn(
+ "\nCPAN::Reporter: ignoring invalid grade:action '$grade_action' for '$name'.\n\n"
);
next PAIR;
}
-
+
# check gradelist
my %grades = map { ($_,1) } split( "/", $grade_list);
- for my $g ( keys %grades ) {
+ for my $g ( keys %grades ) {
if ( ! _is_valid_grade($g) ) {
- $CPAN::Frontend->mywarn(
- "\nCPAN::Reporter: ignoring invalid grade '$g' in '$grade_action' for '$name'.\n\n"
+ $CPAN::Frontend->mywarn(
+ "\nCPAN::Reporter: ignoring invalid grade '$g' in '$grade_action' for '$name'.\n\n"
);
delete $grades{$g};
}
}
-
+
# check action
if ( ! _is_valid_action($action) ) {
- $CPAN::Frontend->mywarn(
- "\nCPAN::Reporter: ignoring invalid action '$action' in '$grade_action' for '$name'.\n\n"
+ $CPAN::Frontend->mywarn(
+ "\nCPAN::Reporter: ignoring invalid action '$action' in '$grade_action' for '$name'.\n\n"
);
next PAIR;
}
@@ -509,9 +555,82 @@ sub _validate_grade_action_pair {
return scalar(keys %ga_map) ? \%ga_map : undef;
}
+sub _validate_transport {
+ my ($name, $option, $config) = @_;
+ my $transport = '';
+
+ if ( $option =~ /^(\w+)\s?/ ) {
+ $transport = $1;
+ my $full_class = "Test::Reporter::Transport::$transport";
+ eval "use $full_class ()";
+ if ($@) {
+ $CPAN::Frontend->mywarn(
+ "\nCPAN::Reporter: error loading $full_class. Please install the missing module or choose a different transport mechanism.\n\n"
+ );
+ }
+ }
+ else {
+ $CPAN::Frontend->mywarn(
+ "\nCPAN::Reporter: Please provide a transport mechanism.\n\n"
+ );
+ return;
+ }
+
+ # we do extra validation for Metabase and offer to create the profile
+ if ( $transport eq 'Metabase' ) {
+ unless ( $option =~ /\buri\s+\S+/ ) {
+ $CPAN::Frontend->mywarn(
+ "\nCPAN::Reporter: Please provide a target uri.\n\n"
+ );
+ return;
+ }
+
+ unless ( $option =~ /\bid_file\s+(\S.+?)\s*$/ ) {
+ $CPAN::Frontend->mywarn(
+ "\nCPAN::Reporter: Please specify an id_file path.\n\n"
+ );
+ return;
+ }
+
+ my $id_file = _normalize_id_file($1);
+
+ # Offer to create if it doesn't exist
+ if ( ! -e $id_file ) {
+ my $answer = CPAN::Shell::colorable_makemaker_prompt(
+ "\nWould you like to run 'metabase-profile' now to create '$id_file'?", "y"
+ );
+ if ( $answer =~ /^y/i ) {
+ return _generate_profile( $id_file, $config );
+ }
+ else {
+ $CPAN::Frontend->mywarn( <<"END_ID_FILE" );
+You can create a Metabase profile by typing 'metabase-profile' in your
+command prompt and moving the resulting file to the location you specified.
+If you did not specify an absolute path, put it in your .cpanreporter
+directory. You will need to do this before continuing.
+END_ID_FILE
+ return;
+ }
+ }
+ # Warn and fail validation if there but not readable
+ elsif (
+ not ( -r $id_file
+ or -r File::Spec->catdir(_get_config_dir(), $id_file)
+ )
+ ) {
+ $CPAN::Frontend->mywarn(
+ "CPAN::Reporter: '$id_file' was not readable.\n\n"
+ );
+ return;
+ }
+ } # end Metabase
+
+ return 1;
+}
+
sub _validate_seconds {
my ($name, $option) = @_;
- return unless defined($option) && length($option)
+ return unless defined($option) && length($option)
&& ($option =~ /^\d/) && $option >= 0;
return $option;
}
@@ -526,6 +645,9 @@ sub _validate_skipfile {
1;
+# ABSTRACT: Config file options for CPAN::Reporter
+
+
=pod
@@ -535,7 +657,7 @@ CPAN::Reporter::Config - Config file options for CPAN::Reporter
=head1 VERSION
-version 1.1902
+version 1.2002
=head1 SYNOPSIS
@@ -545,8 +667,11 @@ From the CPAN shell:
=head1 DESCRIPTION
-Default options for CPAN::Reporter are read from a configuration file
-C<<< .cpanreporter/config.ini >>> in the user's home directory.
+Default options for CPAN::Reporter are read from a configuration file
+C<<< .cpanreporter/config.ini >>> in the user's home directory. (On Win32 platforms,
+the directory will be located in the user's "Documents" directory.)
+The location of the configuration directory or file may be specified
+using environment variables instead.
The configuration file is in "ini" format, with the option name and value
separated by an "=" sign
@@ -554,8 +679,8 @@ separated by an "=" sign
email_from = "John Doe" <johndoe@nowhere.org>
edit_report = no
-Interactive configuration of email address, mail server and common
-action prompts may be repeated at any time from the CPAN shell.
+Interactive configuration of email address and common
+action prompts may be repeated at any time from the CPAN shell.
cpan> o conf init test_report
@@ -569,57 +694,66 @@ options that have been added manually to the configuration file.
=head2 Email Address (required)
-CPAN::Reporter requires users to provide an email address that will be used
-in the "From" header of the email to cpan-testers@perl.org.
+ email_from = <email address>
-=over
+CPAN::Reporter requires users to provide an email address that will be used
+in the header of the report.
-=item *
+The email address provided should be a valid address format, e.g.:
-C<<< email_from = <email address> >>> -- email address of the user sending the
-test report; it should be a valid address format, e.g.:
+ email_from = user@domain
+ email_from = John Doe <user@domain>
+ email_from = "John Q. Public" <user@domain>
-=back
+=head2 Transport (required)
- user@domain
- John Doe <user@domain>
- "John Q. Public" <user@domain>
+ transport = <transport class> [transport args]
-Because C<<< cpan-testers >>> uses a mailing list to collect test reports, it is
-helpful if the email address provided is subscribed to the list. Otherwise,
-test reports will be held until manually reviewed and approved.
+This sets the transport mechanism passed to the C<<< transport() >>> method of
+L<Test::Reporter>. Normally, CPAN::Reporter uses 'Metabase' for transport class
+(i.e. L<Test::Reporter::Transport::Metabase>) and will provide a default set of
+transport arguments.
-Subscribing an account to the cpan-testers list is as easy as sending a blank
-email to cpan-testers-subscribe@perl.org and replying to the confirmation
-email.
+Metabase transport arguments are two space-separated keyE<sol>value pairs:
-=head2 Mail Server
+=over
-By default, Test::Reporter attempts to send mail directly to perl.org mail
-servers. This may fail if a user's computer is behind a network firewall
-that blocks outbound email. In this case, the following option should
-be set to the outbound mail server (i.e., SMTP server) as provided by
-the user's Internet service provider (ISP):
+=item *
-=over
+C<<< uri >>> -- URI for the Metabase API. Defaults to
+C<<< https://metabase.cpantesters.org/api/v1/ >>>
=item *
-C<<< smtp_server = <server list> >>> -- one or more alternate outbound mail servers
-if the default perl.org mail servers cannot be reached; multiple servers may be
-given, separated with a space (none by default)
+C<<< id_file >>> -- path to the user's Metabase profile file.
+Defaults to C<<< metabase_id.json >>>. (Assumed to be in the C<<< .cpanreporter >>>
+directory).
=back
-In at least one reported case, an ISP's outbound mail servers also refused
-to forward mail unless the C<<< email_from >>> was from the ISP-given email address.
+Prior to sending reports, a user must have a valid profile file at the path
+specified. For Metabase transport, CPAN::Reporter will automatically rewrite a
+relative C<<< id_file >>> path as an absolute path located in the C<<< .cpanreporter >>>
+directory.
+
+If the specified profile file does not exist, CPAN::Reporter will offer
+to run C<<< metabase-profile >>> to create it.
+
+For other transport types, see the documentation that comes with your choice of
+Test::Reporter::Transport subclass for the proper way to set the C<<< transport >>>
+configuration option.
=head2 Action Prompts
Several steps in the generation of a test report are optional. Configuration
options control whether an action should be taken automatically or whether
-CPAN::Reporter should prompt the user for the action to take. The action
-to take may be different for each report grade.
+CPAN::Reporter should prompt the user for the action to take. The action to
+take may be different for each report grade. For example, users may wish to
+customize for which grades they wish to manually review a report before sending
+it.
+
+Most users should just accept the default settings until they have some
+experience as CPAN Testers.
Valid actions, and their associated meaning, are as follows:
@@ -654,7 +788,7 @@ which are processed left to right.
An action by itself is taken as a default to be used for any grade which does
not have a grade-specific action. A default action may also be set by using
-the word "default" in place of a grade.
+the word "default" in place of a grade.
edit_report = ask/no
edit_report = default:ask/no
@@ -673,7 +807,7 @@ The action prompt options included in interactive configuration are:
=item *
-C<<< edit_report = <grade:action> ... >>> -- edit the test report before sending?
+C<<< edit_report = <grade:action> ... >>> -- edit the test report before sending?
(default:askE<sol>no passE<sol>na:no)
=item *
@@ -691,10 +825,15 @@ C<<< test_report >>>:
cpan> o conf test_report 0
+=head2 Mail Server (DEPRECATED)
+
+CPAN::Reporter used to send mail directly to perl.org mail servers. The
+C<<< smtp_server >>> option is now deprecated and will be ignored if it exists.
+
=head1 ADVANCED CONFIGURATION OPTIONS
These additional options are only necessary in special cases, for example if
-the default editor cannot be found or if reports shouldn't be sent in
+the default editor cannot be found or if reports shouldn't be sent in
certain situations or for automated testing, and so on.
=over
@@ -702,52 +841,46 @@ certain situations or for automated testing, and so on.
=item *
C<<< command_timeout >>> -- if greater than zero and the CPAN config is
-C<<< inactivity_timeout >>> is not set, then any commands executed by CPAN::Reporter
-will be halted after this many seconds; useful for unattended smoke testing
-to stop after some amount of time; generally, this should be large --
-900 seconds or more -- as some distributions' tests take quite a long time to
-run. On MSWin32, L<Win32::Job> is a needed and trying to kill a processes may
+C<<< inactivity_timeout >>> is not set, then any commands executed by CPAN::Reporter
+will be halted after this many seconds; useful for unattended smoke testing
+to stop after some amount of time; generally, this should be large --
+900 seconds or more -- as some distributions' tests take quite a long time to
+run. On MSWin32, L<Win32::Job> is a needed and trying to kill a processes may
actually deadlock in some situations -- so use at your own risk.
=item *
C<<< editor = <editor> >>> -- editor to use to edit the test report; if not set,
Test::Reporter will use environment variables C<<< VISUAL >>>, C<<< EDITOR >>> or C<<< EDIT >>>
-(in that order) to find an editor
+(in that order) to find an editor
=item *
-C<<< send_duplicates = <grade:action> ... >>> -- should duplicates of previous
+C<<< send_duplicates = <grade:action> ... >>> -- should duplicates of previous
reports be sent, regardless of C<<< send_report >>>? (default:no)
=item *
-C<<< send_PL_report = <grade:action> ... >>> -- if defined, used in place of
+C<<< send_PL_report = <grade:action> ... >>> -- if defined, used in place of
C<<< send_report >>> during the PL phase
=item *
-C<<< send_make_report = <grade:action> ... >>> -- if defined, used in place of
+C<<< send_make_report = <grade:action> ... >>> -- if defined, used in place of
C<<< send_report >>> during the make phase
=item *
-C<<< send_test_report = <grade:action> ... >>> -- if defined, used in place of
+C<<< send_test_report = <grade:action> ... >>> -- if defined, used in place of
C<<< send_report >>> during the test phase
=item *
C<<< send_skipfile = <skipfile> >>> -- filename containing regular expressions (one
-per line) to match against the distribution ID (e.g.
-'AUTHORE<sol>Dist-Name-0.01.tar.gz'); the report will not be sent if a match is
+per line) to match against the distribution ID (e.g.
+'AUTHORE<sol>Dist-Name-0.01.tar.gz'); the report will not be sent if a match is
found; non-absolute filename must be in the .cpanreporter config directory;
-=item *
-
-C<<< transport = <transport> [transport args] >>> -- if defined, passed to the
-C<<< transport() >>> method of L<Test::Reporter>. See below for
-more details. (CPAN::Reporter uses 'Net::SMTP' for this by default.)
-
=back
If these options are manually added to the configuration file, they will
@@ -755,19 +888,19 @@ be included (and preserved) in subsequent interactive configuration.
=head2 Skipfile regular expressions
-Skip files are expected to have one regular expression per line and will be
-matched against the distribution ID, composed of the author's CPAN ID and the
+Skip files are expected to have one regular expression per line and will be
+matched against the distribution ID, composed of the author's CPAN ID and the
distribution tarball name.
DAGOLDEN/CPAN-Reporter-1.00.tar.gz
Lines that begin with a sharp (#) are considered comments and will not be
matched. All regular expressionss will be matched case insensitive and will
-not be anchored unless you provide one.
+not be anchored unless you provide one.
-As the format of a distribution ID is "AUTHORE<sol>tarball", anchoring at the
+As the format of a distribution ID is "AUTHORE<sol>tarball", anchoring at the
start of the line with a caret (^) will match the author and with a slash (E<sol>)
-will match the distribution.
+will match the distribution.
# any distributions by JOHNDOE
^JOHNDOE
@@ -776,24 +909,6 @@ will match the distribution.
# a particular very specific distribution
^JOHNDOE/Foo-Bar-3.14
-=head2 Transport options
-
-The L<Test::Reporter> 1.39_XX development series added support for multiple
-transport modules, e.g. L<Test::Reporter::Transport::Net::SMTP::TLS> or
-L<Test::Reporter::Transport::HTTPGateway>. To use them with CPAN::Reporter,
-set the 'transport' config option to the name of the transport module
-(without the 'Test::Reporter::Transport' prefix) and any required arguments,
-separated by white space. For example:
-
- transport=Net::SMTP Port 587
- transport=Net::SMTP::TLS User jdoe@example.com Password 12345
- transport=HTTPGateway http://example.com/cpantesters.cgi MyKey
- transport=File ~/saved-reports-dir
-
-The transport module may be any Test::Reporter::Transport installed on your
-system. As of Test::Reporter 1.39_05, transports included 'Net::SMTP',
-'Net::SMTP::TLS', 'Mail::Send', 'HTTPGateway' and 'File'.
-
=head1 CONFIGURATION OPTIONS FOR DEBUGGING
These options are useful for debugging only:
@@ -804,16 +919,11 @@ These options are useful for debugging only:
C<<< debug = <boolean> >>> -- turns debugging onE<sol>off
-=item *
-
-C<<< email_to = <email address> >>> -- alternate destination for reports instead of
-C<<< cpan-testers@perl.org >>>; used for testing
-
=back
=head1 ENVIRONMENT
-The following environment variables may be set to alter the default locations
+The following environment variables may be set to alter the default locations
for CPAN::Reporter files:
=over
@@ -821,15 +931,15 @@ for CPAN::Reporter files:
=item *
C<<< PERL_CPAN_REPORTER_DIR >>> -- if set, this directory is used in place of
-the default .cpanreporter directory; this will affect not only the location
-of the default C<<< config.ini >>>, but also the location of the
+the default C<<< .cpanreporter >>> directory; this will affect not only the location
+of the default C<<< config.ini >>>, but also the location of the
L<CPAN::Reporter::History> database and any other files that live in that
directory
=item *
-C<<< PERL_CPAN_REPORTER_CONFIG >>> -- if set, this file is used in place of
-the default C<<< config.ini >>> file; it may be in any directory, regardless of the
+C<<< PERL_CPAN_REPORTER_CONFIG >>> -- if set, this file is used in place of
+the default C<<< config.ini >>> file; it may be in any directory, regardless of the
choice of configuration directory
=back
@@ -852,24 +962,7 @@ L<CPAN::Reporter::FAQ>
=back
-=head1 AUTHOR
-
-David A. Golden (DAGOLDEN)
-
-=head1 COPYRIGHT AND LICENSE
-
-Copyright (c) 2006, 2007, 2008 by David A. Golden
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-L<http://www.apache.org/licenses/LICENSE-2.0>
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
+# vim: ts=4 sts=4 sw=4 et:
=head1 AUTHOR
@@ -1,23 +1,12 @@
-#
-# This file is part of CPAN-Reporter
-#
-# This software is Copyright (c) 2006 by David Golden.
-#
-# This is free software, licensed under:
-#
-# The Apache License, Version 2.0, January 2004
-#
use strict; # make CPANTS happy
package CPAN::Reporter::FAQ;
-BEGIN {
- $CPAN::Reporter::FAQ::VERSION = '1.1902';
-}
-# ABSTRACT: Answers and tips for using CPAN::Reporter
+our $VERSION = '1.2002'; # VERSION
-# Not really a .pm file, but holds wikidoc which will be
-# turned into .pod by the Build.PL
1;
+# ABSTRACT: Answers and tips for using CPAN::Reporter
+
+
=pod
@@ -27,7 +16,7 @@ CPAN::Reporter::FAQ - Answers and tips for using CPAN::Reporter
=head1 VERSION
-version 1.1902
+version 1.2002
=head1 REPORT GRADES
@@ -36,7 +25,7 @@ version 1.1902
Historically, CPAN Testers was designed to have each tester send a copy of
reports to authors. This philosophy changed in September 2008 and CPAN Testers
tools were updated to no longer copy authors, but some testers may still be
-using an older versions.
+using an older version.
=head2 Why was a report sent if a prerequisite is missing?
@@ -53,42 +42,43 @@ prerequisites.
=head2 Why did I get an error sending a test report?
-Test reports are sent via ordinary email. The most common reason for errors
-sending a report is that many Internet Service Providers (ISP's) will block
+Historically, test reports were sent via ordinary email.
+The most common reason for errors sending a report back then was that
+many Internet Service Providers (ISP's) would block
outbound SMTP (email) connections as part of their efforts to fight spam.
-Instead, email must be routed to the ISP's outbound mail servers, which will
-relay the email to the intended destination.
-You can configure CPAN::Reporter to use a specific outbound email server
-with the C<<< smtp_server >>> configuration option.
-
- smtp_server = mail.some-isp.com
-
-In at least one case, an ISP has blocked outbound email unless the
-"from" address was the assigned email address from that ISP.
+Since 2010, test reports are sent to the CPAN Testers Metabase over HTTPS. The
+most common reason for failures are systems which upgraded CPAN::Reporter but
+are still configured to use the deprecated and unsupported email system instead
+of Metabase for transport.
+
+If you are unsure which transport mechanism you're using, look for the
+C<<< transport >>> rule in the C<<< .cpanreporter/config.ini >>> file, in the
+user's home directory. See L<CPAN::Reporter::Config> for details on how
+to set the C<<< transport >>> option for Metabase.
+
+Other errors could be caused by the absence of the
+C<<< .cpanreporter/metabase_id.json >>> file in the user's home directory. This file
+should be manually created prior to sending any reports, via the
+C<<< metabase-profile >>> program. Simply run it and fill the informations
+accordingly, and it will create the C<<< metabase_id.json >>> file for you. Move that
+file to your C<<< .cpanreporter >>> directory and you're all set.
+
+Finally, lack of Internet connection or firewall filtering will prevent
+the report from reaching the CPAN Testers servers. If you are experiencing
+HTTPS issues or messages complaining about SSL modules, try installing
+the L<LWP::Protocol::https> module and trying again. If all fails, you
+may still change the transport uri to use HTTP instead of HTTPS, though
+this is I<not> recommended.
=head2 Why didn't my test report show up on CPAN Testers?
-CPAN Testers uses a mailing list to collect test reports. If the email
-address you set in C<<< email_from >>> is subscribed to the list, your emails
-will be automatically processed. Otherwise, test reports will be held
-until manually reviewed and approved.
-
-Subscribing an account to the cpan-testers list is as easy as sending a blank
-email to cpan-testers-subscribe@perl.org and replying to the confirmation
-email.
-
-There is a delay between the time emails appear on the mailing list and the
-time they appear on the CPAN Testers website. There is a further delay before
-summary statistics appear on search.cpan.org.
-
-If your email address is subscribed to the list but your test reports are still
-not showing up, your outbound email may have been silently blocked by your
-ISP. See the question above about errors sending reports.
-
-=head2 Why don't you support sending reports via HTTP or authenticated SMTP?
-
-We do! See the C<<< transport >>> option in L<CPAN::Reporter::Config>.
+There is a delay between the time reports are sent to the Metabase and when
+they they appear on the CPAN Testers website. There is a further delay before
+summary statistics appear on search.cpan.org. If your reports do not appear
+after 24 hours, please contact the cpan-testers-discuss email list
+(L<http://lists.perl.org/list/cpan-testers-discuss.html>) or join the
+C<<< #cpantesters-discuss >>> IRC channel on C<<< irc.perl.org >>>.
=head1 CPAN TESTERS
@@ -103,17 +93,8 @@ CPAN Testers statistics are compiled at L<http://stats.cpantesters.org/>
=head2 How do I make sure I get credit for my test reports?
-To get credit in the statistics, use the same email address wherever
-you run tests.
-
-For example, if you are a CPAN author, use your PAUSEID email address.
-
- email_from = pauseid@cpan.org
-
-Otherwise, you should use a consistent "Full Name" as part of your
-email address in the C<<< email_from >>> option.
-
- email_from = "John Doe" <john.doe@example.com>
+To get credit in the statistics, use the same Metabase profile file
+and the same email address wherever you run tests.
=head1 SEE ALSO
@@ -1,25 +1,13 @@
-#
-# This file is part of CPAN-Reporter
-#
-# This software is Copyright (c) 2006 by David Golden.
-#
-# This is free software, licensed under:
-#
-# The Apache License, Version 2.0, January 2004
-#
-use strict;
+use strict;
package CPAN::Reporter::History;
-BEGIN {
- $CPAN::Reporter::History::VERSION = '1.1902';
-}
-# ABSTRACT: Read or write a CPAN::Reporter history log
+our $VERSION = '1.2002'; # VERSION
use vars qw/@ISA @EXPORT_OK/;
use Config;
use Carp;
use Fcntl qw/:flock/;
-use File::HomeDir ();
+use File::HomeDir ();
use File::Path (qw/mkpath/);
use File::Spec ();
use IO::File ();
@@ -36,9 +24,9 @@ require Exporter;
BEGIN {
eval {
- my $temp_file = File::Spec->catfile(
- File::Spec->tmpdir(), $$ . time()
- );
+ my $temp_file = File::Spec->catfile(
+ File::Spec->tmpdir(), $$ . time()
+ );
my $fh = IO::File->new( $temp_file, "w" );
flock $fh, LOCK_EX;
$fh->close;
@@ -55,8 +43,8 @@ BEGIN {
# 0.99_08 changed the history file format and name
-# If an old file exists, convert it to the new name and format. Note --
-# someone running multiple installations of CPAN::Reporter might have old
+# If an old file exists, convert it to the new name and format. Note --
+# someone running multiple installations of CPAN::Reporter might have old
# and new versions running so only convert in the case where the old file
# exists and the new file does not
@@ -78,8 +66,7 @@ BEGIN {
last;
}
- print {$new_fh} "# Generated by CPAN::Reporter " .
- "$CPAN::Reporter::Config::VERSION\n";
+ print {$new_fh} _generated_by();
while ( my $line = <$old_fh> ) {
chomp $line;
# strip off perl version and convert
@@ -90,7 +77,7 @@ BEGIN {
($old_version, $perl_patch) = ($1, $2);
$line =~ s{ (5\.0\d{2,5}) ?(patch \d+)?\z}{};
}
- my $pv = $old_version ? "perl-" . _perl_version($old_version)
+ my $pv = $old_version ? "perl-" . _perl_version($old_version)
: "unknown";
$pv .= " $perl_patch" if $perl_patch;
my ($grade_dist, $arch_os) = ($line =~ /(\S+ \S+) (.+)/);
@@ -106,24 +93,24 @@ BEGIN {
#--------------------------------------------------------------------------#
#--------------------------------------------------------------------------#
-# have_tested -- search for dist in history file
+# have_tested -- search for dist in history file
#--------------------------------------------------------------------------#
sub have_tested { ## no critic RequireArgUnpacking
# validate arguments
croak "arguments to have_tested() must be key value pairs"
- if @_ % 2;
-
+ if @_ % 2;
+
my $args = { @_ };
- my @bad_params = grep {
+ my @bad_params = grep {
$_ !~ m{^(?:dist|phase|grade|perl|archname|osvers)$} } keys %$args;
- croak "bad parameters for have_tested(): " . join(q{, },@bad_params)
+ croak "bad parameters for have_tested(): " . join(q{, },@bad_params)
if @bad_params;
-
-
+
+
# DWIM: grades to upper case
- $args->{grade} = uc $args->{grade} if defined $args->{grade};
+ $args->{grade} = uc $args->{grade} if defined $args->{grade};
# default to current platform
$args->{perl} = _format_perl_version() unless defined $args->{perl};
@@ -141,13 +128,13 @@ sub have_tested { ## no critic RequireArgUnpacking
$history->close;
return @found;
}
-
+
#--------------------------------------------------------------------------#
# Private methods
#--------------------------------------------------------------------------#
#--------------------------------------------------------------------------#
-# _format_history --
+# _format_history --
#
# phase grade dist-version (perl-version patchlevel) archname osvers
#--------------------------------------------------------------------------#
@@ -158,7 +145,7 @@ sub _format_history {
my $grade = uc $result->{grade};
my $dist_name = $result->{dist_name};
my $perlver = "perl-" . _format_perl_version();
- my $platform = "$Config{archname} $Config{osvers}";
+ my $platform = "$Config{archname} $Config{osvers}";
return "$phase $grade $dist_name ($perlver) $platform\n";
}
@@ -168,18 +155,23 @@ sub _format_history {
sub _format_perl_version {
my $pv = _perl_version();
- $pv .= " patch $Config{perl_patchlevel}"
+ $pv .= " patch $Config{perl_patchlevel}"
if $Config{perl_patchlevel};
return $pv;
}
+sub _generated_by {
+ return "# Generated by CPAN::Reporter "
+ . "$CPAN::Reporter::History::VERSION\n";
+}
+
#--------------------------------------------------------------------------#
# _get_history_file
#--------------------------------------------------------------------------#
sub _get_history_file {
- return File::Spec->catdir(
- CPAN::Reporter::Config::_get_config_dir(), "reports-sent.db"
+ return File::Spec->catdir(
+ CPAN::Reporter::Config::_get_config_dir(), "reports-sent.db"
);
}
@@ -188,8 +180,8 @@ sub _get_history_file {
#--------------------------------------------------------------------------#
sub _get_old_history_file {
- return File::Spec->catdir(
- CPAN::Reporter::Config::_get_config_dir(), "history.db"
+ return File::Spec->catdir(
+ CPAN::Reporter::Config::_get_config_dir(), "history.db"
);
}
@@ -242,14 +234,13 @@ sub _open_history_file {
my $history = IO::File->new( $history_filename, $mode )
or $CPAN::Frontend->mywarn("CPAN::Reporter: couldn't open history file "
. "'$history_filename': $!\n");
-
+
# if writing and it didn't exist before, initialize with header
if ( substr($mode,0,1) eq '>' && ! $file_exists ) {
- print {$history} "# Generated by CPAN::Reporter " .
- "$CPAN::Reporter::Config::VERSION\n";
+ print {$history} _generated_by();
}
- return $history;
+ return $history;
}
#--------------------------------------------------------------------------#
@@ -283,7 +274,7 @@ sub _record_history {
seek( $history, 0, 2 ); # seek to end of file
$history->print( $log_line );
flock( $history, LOCK_UN );
-
+
$history->close;
return;
}
@@ -308,7 +299,7 @@ sub _split_history {
(\S+) \s+ # archname
(.+)$ # osvers
}xms;
-
+
# return nothing if parse fails
return if scalar keys %fields == 0;# grep { ! defined($_) } values %fields;
# otherwise return hashref
@@ -317,6 +308,9 @@ sub _split_history {
1;
+# ABSTRACT: Read or write a CPAN::Reporter history log
+
+
=pod
@@ -326,7 +320,7 @@ CPAN::Reporter::History - Read or write a CPAN::Reporter history log
=head1 VERSION
-version 1.1902
+version 1.2002
=head1 SYNOPSIS
@@ -338,7 +332,7 @@ version 1.1902
Interface for interacting with the CPAN::Reporter history file. Most methods
are private for use only within CPAN::Reporter itself. However, a public
-function is provided to query the history file for results.
+function is provided to query the history file for results.
=head1 USAGE
@@ -356,7 +350,7 @@ The following function is available. It is not exported by default.
@results = have_tested();
Searches the CPAN::Reporter history file for records exactly matching search
-criteria, given as pairs of field-names and desired values.
+criteria, given as pairs of field-names and desired values.
Ordinary search criteria include:
@@ -364,12 +358,12 @@ Ordinary search criteria include:
=item *
-C<<< dist >>> -- the distribution tarball name without any filename suffix; from
+C<<< dist >>> -- the distribution tarball name without any filename suffix; from
a C<<< CPAN::Distribution >>> object, this is provided by the C<<< base_id >>> method.
=item *
-C<<< phase >>> -- phase the report was generated during: either 'PL',
+C<<< phase >>> -- phase the report was generated during: either 'PL',
'make' or 'test'
=item *
@@ -380,11 +374,11 @@ be 'DISCARD' for any failing reports not sent due to missing prerequisites
=back
Without additional criteria, a search will be limited to the current
-version of Perl and the current architecture and OS version.
-Additional criteria may be specified explicitly or, by specifying the empty
+version of Perl and the current architecture and OS version.
+Additional criteria may be specified explicitly or, by specifying the empty
string, C<<< q{} >>>, will match that field for I<any> record.
- # all reports for Foo-Bar-1.23 on any version of perl
+ # all reports for Foo-Bar-1.23 on any version of perl
# on the current architecture and OS version
@results = have_tested( dist => 'Foo-Bar-1.23', perl => q{} );
@@ -1,27 +1,11 @@
-#
-# This file is part of CPAN-Reporter
-#
-# This software is Copyright (c) 2006 by David Golden.
-#
-# This is free software, licensed under:
-#
-# The Apache License, Version 2.0, January 2004
-#
use strict;
package CPAN::Reporter::PrereqCheck;
-BEGIN {
- $CPAN::Reporter::PrereqCheck::VERSION = '1.1902';
-}
-# ABSTRACT: Modulino for prerequisite tests
+our $VERSION = '1.2002'; # VERSION
use ExtUtils::MakeMaker 6.36;
use File::Spec;
use CPAN::Version;
-my %substitute = (
- 'Module::Install' => 'inc::Module::Install',
-);
-
_run() if ! caller();
sub _run {
@@ -35,19 +19,16 @@ sub _run {
die "Couldn't read module for '$_'" unless $mod;
$need = 0 if not defined $need;
- # handle any odd cases
- my $testmod = $substitute{$mod} || $mod;
-
# only evaluate a module once
- next if $saw_mod{$testmod}++;
+ next if $saw_mod{$mod}++;
# get installed version from file with EU::MM
my($have, $inst_file, $dir, @packpath);
- if ( $testmod eq "perl" ) {
+ if ( $mod eq "perl" ) {
$have = $];
}
else {
- @packpath = split( /::/, $testmod );
+ @packpath = split( /::/, $mod );
$packpath[-1] .= ".pm";
if (@packpath == 1 && $packpath[0] eq "readline.pm") {
unshift @packpath, "Term", "ReadLine"; # historical reasons
@@ -68,7 +49,7 @@ sub _run {
# report broken if it can't be loaded
# "select" to try to suppress spurious newlines
select DEVNULL; ## no critic
- if ( ! eval "use $testmod (); 1" ) {
+ if ( ! _try_load( $mod, $have, $inst_file ) ) {
select STDOUT; ## no critic
print "$mod 0 broken\n";
next;
@@ -121,8 +102,22 @@ sub _run {
return;
}
+sub _try_load {
+ my ($module, $have, $file) = @_;
+
+ # M::I < 0.95 dies in require, so we can't check if it loads
+ # Instead we just pretend that it works
+ if ( $module eq 'Module::Install' && $have < 0.95 ) {
+ return 1;
+ }
+
+ return eval q{require $file; 1};
+}
+
1;
+# ABSTRACT: Modulino for prerequisite tests
+
=pod
@@ -133,7 +128,7 @@ CPAN::Reporter::PrereqCheck - Modulino for prerequisite tests
=head1 VERSION
-version 1.1902
+version 1.2002
=head1 SYNOPSIS
@@ -1,21 +1,9 @@
-#
-# This file is part of CPAN-Reporter
-#
-# This software is Copyright (c) 2006 by David Golden.
-#
-# This is free software, licensed under:
-#
-# The Apache License, Version 2.0, January 2004
-#
use strict;
package CPAN::Reporter;
-BEGIN {
- $CPAN::Reporter::VERSION = '1.1902';
-}
-# ABSTRACT: Adds CPAN Testers reporting to CPAN.pm
+our $VERSION = '1.2002'; # VERSION
use Config;
-use Capture::Tiny 'capture';
+use Capture::Tiny qw/ capture tee_merged /;
use CPAN 1.9301 ();
use CPAN::Version ();
use File::Basename qw/basename dirname/;
@@ -27,7 +15,6 @@ use File::Temp 0.16 qw/tempdir/;
use IO::File ();
use Parse::CPAN::Meta ();
use Probe::Perl ();
-use Tee 0.14 qw/tee/;
use Test::Reporter 1.54 ();
use CPAN::Reporter::Config ();
use CPAN::Reporter::History ();
@@ -135,8 +122,6 @@ sub record_command {
my ($cmd, $redirect) = _split_redirect($command);
- my $temp_out = _temp_filename( 'CPAN-Reporter-TO-' );
-
# Teeing a command loses its exit value so we must wrap the command
# and print the exit code so we can read it off of output
my $wrap_code;
@@ -164,28 +149,19 @@ HERE
$wrapper_fh->close;
# tee the command wrapper
- my $tee_input = Probe::Perl->find_perl_interpreter() . " $wrapper_name";
- $tee_input .= " $redirect" if defined $redirect;
+ my @tee_input = ( Probe::Perl->find_perl_interpreter, $wrapper_name );
+ push @tee_input, $redirect if defined $redirect;
+ my $tee_out;
{
# ensure autoflush if we can
local $ENV{PERL5OPT} = _get_perl5opt() if _is_PL($command);
- tee($tee_input, { stderr => 1 }, $temp_out);
- }
-
- # read back the output
- my $output_fh = IO::File->new($temp_out, "r");
- if ( !$output_fh ) {
- $CPAN::Frontend->mywarn(
- "CPAN::Reporter: couldn't read command results for '$cmd'\n"
- );
- return;
+ $tee_out = tee_merged { system( @tee_input ) };
}
- my @cmd_output = <$output_fh>;
- $output_fh->close;
# cleanup
- unlink $wrapper_name, $temp_out unless $ENV{PERL_CR_NO_CLEANUP};
+ unlink $wrapper_name unless $ENV{PERL_CR_NO_CLEANUP};
+ my @cmd_output = split qr{(?<=$/)}, $tee_out;
if ( ! @cmd_output ) {
$CPAN::Frontend->mywarn(
"CPAN::Reporter: didn't capture command results for '$cmd'\n"
@@ -373,10 +349,9 @@ sub _dispatch_report {
CPAN::Reporter: required 'email_from' option missing an email address, so
test report will not be sent. See documentation for configuration details.
-Even for non-email transports (e.g. Metabase, File or Socket) this email
-address will show up in the report and help identify the tester.
-This is required for compatibility with tools that process legacy reports
-for analysis.
+Even though CPAN Testers no longer uses email, this email address will
+show up in the report and help identify the tester. This is required
+for compatibility with tools that process legacy reports for analysis.
EMAIL_REQUIRED
return;
@@ -462,8 +437,27 @@ DUPLICATE_REPORT
# Set debug and transport options, if supported
$tr->debug( $config->{debug} ) if defined $config->{debug};
- my $transport = $config->{transport} || 'Net::SMTP';
+ my $transport = $config->{transport};
+ unless ( defined $transport && length $transport ) {
+ $CPAN::Frontend->mywarn( << "TRANSPORT_REQUIRED");
+
+CPAN::Reporter: required 'transport' option missing so the test report
+will not be sent. See documentation for configuration details.
+
+TRANSPORT_REQUIRED
+ return;
+ }
my @transport_args = split " ", $transport;
+
+ # special hack for Metabase arguments
+ if ($transport_args[0] eq 'Metabase') {
+ @transport_args = _validate_metabase_args(@transport_args);
+ unless (@transport_args) {
+ $CPAN::Frontend->mywarn( "Test report will not be sent.\n\n" );
+ return;
+ }
+ }
+
eval { $tr->transport( @transport_args ) };
if ($@) {
$CPAN::Frontend->mywarn(
@@ -476,11 +470,6 @@ DUPLICATE_REPORT
# prepare mail transport
$tr->from( $config->{email_from} );
- $tr->address( $config->{email_to} ) if $config->{email_to};
- if ( $config->{smtp_server} ) {
- my @mx = split " ", $config->{smtp_server};
- $tr->mx( \@mx );
- }
# Populate the test report
$tr->comments( _report_text( $result ) );
@@ -1321,6 +1310,7 @@ HERE
my @toolchain_mods= qw(
CPAN
+ CPAN::Meta
Cwd
ExtUtils::CBuilder
ExtUtils::Command
@@ -1329,13 +1319,16 @@ my @toolchain_mods= qw(
ExtUtils::Manifest
ExtUtils::ParseXS
File::Spec
+ JSON
+ JSON::PP
Module::Build
Module::Signature
+ Parse::CPAN::Meta
Test::Harness
Test::More
- version
YAML
YAML::Syck
+ version
);
sub _toolchain_report {
@@ -1364,6 +1357,64 @@ sub _toolchain_report {
}
+#--------------------------------------------------------------------------#
+# _validate_metabase_args
+#
+# This is a kludge to make metabase transport args a little less
+# clunky for novice users
+#--------------------------------------------------------------------------#
+
+sub _validate_metabase_args {
+ my @transport_args = @_;
+ shift @transport_args; # drop leading 'Metabase'
+ my (%args, $error);
+
+ if ( @transport_args % 2 != 0 ) {
+ $error = << "TRANSPORT_ARGS";
+
+CPAN::Reporter: Metabase 'transport' option had odd number of
+parameters in the config file. See documentation for proper
+configuration format.
+
+TRANSPORT_ARGS
+ }
+ else {
+ %args = @transport_args;
+
+ for my $key ( qw/uri id_file/ ) {
+ if ( ! $args{$key} ) {
+ $error = << "TRANSPORT_ARGS";
+
+CPAN::Reporter: Metabase 'transport' option did not have
+a '$key' parameter in the config file. See documentation for
+proper configuration format.
+
+TRANSPORT_ARGS
+ }
+ }
+ }
+
+ if ( $error ) {
+ $CPAN::Frontend->mywarn( $error );
+ return;
+ }
+
+ $args{id_file} = CPAN::Reporter::Config::_normalize_id_file( $args{id_file} );
+
+ if ( ! -r $args{id_file} ) {
+ $CPAN::Frontend->mywarn( <<"TRANSPORT_ARGS" );
+
+CPAN::Reporter: Could not find Metabase tranport 'id_file' parameter
+located at '$args{id_file}'.
+See documentation for proper configuration of the 'transport' setting.
+
+TRANSPORT_ARGS
+ return;
+ }
+
+ return ('Metabase', %args);
+}
+
#--------------------------------------------------------------------------#
# _version_finder
@@ -1415,7 +1466,9 @@ sub _version_finder {
return \%result;
}
-1; #this line is important and will help the module return a true value
+1;
+
+# ABSTRACT: Adds CPAN Testers reporting to CPAN.pm
@@ -1427,16 +1480,22 @@ CPAN::Reporter - Adds CPAN Testers reporting to CPAN.pm
=head1 VERSION
-version 1.1902
+version 1.2002
=head1 SYNOPSIS
From the CPAN shell:
- cpan> install CPAN::Reporter
+ cpan> install Task::CPAN::Reporter
cpan> reload cpan
cpan> o conf init test_report
+Installing L<Task::CPAN::Reporter> will pull in additional dependencies
+that new CPAN Testers will need.
+
+Advanced CPAN Testers with custom L<Test::Reporter::Transport> setups
+may wish to install only CPAN::Reporter, which has fewer dependencies.
+
=head1 DESCRIPTION
The CPAN Testers project captures and analyses detailed results from building
@@ -1489,13 +1548,12 @@ Users will need to enter an email address in one of the following formats:
John Doe <johndoe@example.com>
"John Q. Public" <johnqpublic@example.com>
-Users will also be prompted to enter the name of an outbound email server. It
-is recommended to use an email server provided by the user's ISP or company.
-Alternatively, leave this blank to attempt to send email directly to perl.org.
-
Users that are new to CPAN::Reporter should accept the recommended values
for other configuration options.
+Users will be prompted to create a I<Metabase profile> file that uniquely
+identifies their test reports. See L</"The Metabase"> below for details.
+
After completing interactive configuration, be sure to commit (save) the CPAN
configuration changes.
@@ -1503,18 +1561,31 @@ configuration changes.
See L<CPAN::Reporter::Config> for advanced configuration settings.
+=head3 The Metabase
+
+CPAN::Reporter sends test reports to a server known as the Metabase. This
+requires an active Internet connection and a profile file. To create the
+profile, users will need to run C<<< metabase-profile >>> from a terminal window and
+fill the information at the prompts. This will create a file called
+C<<< metabase_id.json >>> in the current directory. That file should be moved to the
+C<<< .cpanreporter >>> directory inside the user's home dir.
+
+Users with an existing metabase profile file (e.g. from another machine),
+should copy it into the C<<< .cpanreporter >>> directory instead of creating
+a new one. Profile files may be located outside the C<<< .cpanreporter >>>
+directory by following instructions in L<CPAN::Reporter::Config>.
+
=head2 Using CPAN::Reporter
Once CPAN::Reporter is enabled and configured, test or install modules with
CPAN.pm as usual.
-For example, to force CPAN to repeat tests for CPAN::Reporter to see how it
-works:
+For example, to test the File::Marker module:
- cpan> force test CPAN::Reporter
+ cpan> test File::Marker
-When distribution tests fail, users will be prompted to edit the report to add
-addition information.
+If a distribution's tests fail, users will be prompted to edit the report to
+add additional information that might help the author understand the failure.
=head1 UNDERSTANDING TEST GRADES
@@ -1612,6 +1683,25 @@ L<CPAN::Reporter::FAQ> -- hints and tips
=back
+=for :stopwords cpan testmatrix url annocpan anno bugtracker rt cpants kwalitee diff irc mailto metadata placeholders
+
+=head1 SUPPORT
+
+=head2 Bugs / Feature Requests
+
+Please report any bugs or feature requests by email to C<bug-cpan-reporter at rt.cpan.org>, or through
+the web interface at L<http://rt.cpan.org/Public/Dist/Display.html?Name=CPAN-Reporter>. You will be automatically notified of any
+progress on the request by the system.
+
+=head2 Source Code
+
+This is open source software. The code repository is available for
+public review and contribution under the terms of the license.
+
+L<http://github.com/dagolden/cpan-reporter>
+
+ git clone http://github.com/dagolden/cpan-reporter
+
=head1 AUTHOR
David Golden <dagolden@cpan.org>
@@ -1629,3 +1719,5 @@ This is free software, licensed under:
__END__
+
+# vim: ts=4 sts=4 sw=4 et:
@@ -1,13 +1,4 @@
#!perl
-#
-# This file is part of CPAN-Reporter
-#
-# This software is Copyright (c) 2006 by David Golden.
-#
-# This is free software, licensed under:
-#
-# The Apache License, Version 2.0, January 2004
-#
use strict;
use warnings;
@@ -33,7 +24,18 @@ find(
'lib',
);
-my @scripts = glob "bin/*";
+my @scripts;
+if ( -d 'bin' ) {
+ find(
+ sub {
+ return unless -f;
+ my $found = $File::Find::name;
+ # nothing to skip
+ push @scripts, $found;
+ },
+ 'bin',
+ );
+}
my $plan = scalar(@modules) + scalar(@scripts);
$plan ? (plan tests => $plan) : (plan skip_all => "no tests to run");
@@ -1,13 +1,4 @@
#!perl
-#
-# This file is part of CPAN-Reporter
-#
-# This software is Copyright (c) 2006 by David Golden.
-#
-# This is free software, licensed under:
-#
-# The Apache License, Version 2.0, January 2004
-#
use strict;
BEGIN{ if (not $] < 5.006) { require warnings; warnings->import } }
@@ -18,12 +9,14 @@ use Test::More;
use Config::Tiny;
use IO::CaptureOutput qw/capture/;
use File::Basename qw/basename/;
+use File::Glob qw/bsd_glob/;
use File::Spec;
use File::Temp qw/tempdir/;
+use File::Path qw/mkpath/;
use t::Frontend;
use t::MockHomeDir;
-plan tests => 56;
+plan tests => 62;
#plan 'no_plan';
#--------------------------------------------------------------------------#
@@ -32,13 +25,15 @@ plan tests => 56;
my $config_dir = File::Spec->catdir( t::MockHomeDir::home_dir, ".cpanreporter" );
my $config_file = File::Spec->catfile( $config_dir, "config.ini" );
+my $metabase_file = File::Spec->catfile( $config_dir, 'metabase_id.json' );
my $default_options = {
email_from => '',
edit_report => 'default:ask/no pass/na:no',
send_report => 'default:ask/yes pass/na:yes',
+ transport => "Metabase uri https://metabase.cpantesters.org/api/v1/ id_file metabase_id.json",
# send_duplicates => 'default:no',
};
-my @additional_prompts = qw/ smtp_server /;
+my @additional_prompts = ();
my ($rc, $stdout, $stderr);
@@ -46,7 +41,14 @@ my ($rc, $stdout, $stderr);
#--------------------------------------------------------------------------#
# Mocking -- override support/system functions
#--------------------------------------------------------------------------#
-
+{
+ # touch our mock metabase_id.json file
+ mkpath $config_dir;
+ # 2-args open with bare descriptor to work in older perls
+ open METABASE, ">$metabase_file";
+ close METABASE;
+ ok -r $metabase_file, 'created mock metabase file for testing';
+}
#--------------------------------------------------------------------------#
@@ -61,6 +63,21 @@ is( CPAN::Reporter::Config::_get_config_file(), $config_file,
"get config file path"
);
+# id_file normalizations
+my @id_file_cases = (
+ [ $metabase_file => $metabase_file ],
+ [ 'metabase_id.json' => $metabase_file ],
+ [ '/other/path.json' => '/other/path.json' ],
+ [ 'other.json' => File::Spec->catfile( $config_dir, 'other.json' )],
+ [ '~/other.json' => File::Spec::Unix->catfile( bsd_glob('~'), 'other.json' )],
+);
+
+for my $c ( @id_file_cases ) {
+ is( CPAN::Reporter::Config::_normalize_id_file( $c->[0] ), $c->[1],
+ "normalize id_file: $c->[0]"
+ );
+}
+
ok( ! -f $config_file,
"no config file yet"
);
@@ -1,13 +1,4 @@
#!perl
-#
-# This file is part of CPAN-Reporter
-#
-# This software is Copyright (c) 2006 by David Golden.
-#
-# This is free software, licensed under:
-#
-# The Apache License, Version 2.0, January 2004
-#
use strict;
BEGIN{ if (not $] < 5.006) { require warnings; warnings->import } }
@@ -1,13 +1,4 @@
#!perl
-#
-# This file is part of CPAN-Reporter
-#
-# This software is Copyright (c) 2006 by David Golden.
-#
-# This is free software, licensed under:
-#
-# The Apache License, Version 2.0, January 2004
-#
use strict;
BEGIN{ if (not $] < 5.006) { require warnings; warnings->import } }
@@ -1,13 +1,4 @@
#!perl
-#
-# This file is part of CPAN-Reporter
-#
-# This software is Copyright (c) 2006 by David Golden.
-#
-# This is free software, licensed under:
-#
-# The Apache License, Version 2.0, January 2004
-#
use strict;
BEGIN{ if (not $] < 5.006) { require warnings; warnings->import } }
@@ -1,13 +1,4 @@
#!perl
-#
-# This file is part of CPAN-Reporter
-#
-# This software is Copyright (c) 2006 by David Golden.
-#
-# This is free software, licensed under:
-#
-# The Apache License, Version 2.0, January 2004
-#
use strict;
BEGIN{ if (not $] < 5.006) { require warnings; warnings->import } }
@@ -1,13 +1,4 @@
#!perl
-#
-# This file is part of CPAN-Reporter
-#
-# This software is Copyright (c) 2006 by David Golden.
-#
-# This is free software, licensed under:
-#
-# The Apache License, Version 2.0, January 2004
-#
use strict;
BEGIN{ if (not $] < 5.006) { require warnings; warnings->import } }
@@ -1,13 +1,4 @@
#!perl
-#
-# This file is part of CPAN-Reporter
-#
-# This software is Copyright (c) 2006 by David Golden.
-#
-# This is free software, licensed under:
-#
-# The Apache License, Version 2.0, January 2004
-#
use strict;
BEGIN{ if (not $] < 5.006) { require warnings; warnings->import } }
@@ -1,13 +1,4 @@
#!perl
-#
-# This file is part of CPAN-Reporter
-#
-# This software is Copyright (c) 2006 by David Golden.
-#
-# This is free software, licensed under:
-#
-# The Apache License, Version 2.0, January 2004
-#
use strict;
BEGIN{ if (not $] < 5.006) { require warnings; warnings->import } }
@@ -24,8 +15,8 @@ my @cases = (
{
label => "skipfile (exists)",
option => "cc_skipfile",
- input => File::Spec->rel2abs("README"),
- output => File::Spec->rel2abs("README"),
+ input => File::Spec->rel2abs("Changes"),
+ output => File::Spec->rel2abs("Changes"),
},
{
label => "skipfile (missing)",
@@ -1,13 +1,4 @@
#!perl
-#
-# This file is part of CPAN-Reporter
-#
-# This software is Copyright (c) 2006 by David Golden.
-#
-# This is free software, licensed under:
-#
-# The Apache License, Version 2.0, January 2004
-#
use strict;
BEGIN{ if (not $] < 5.006) { require warnings; warnings->import } }
@@ -1,13 +1,4 @@
#!perl
-#
-# This file is part of CPAN-Reporter
-#
-# This software is Copyright (c) 2006 by David Golden.
-#
-# This is free software, licensed under:
-#
-# The Apache License, Version 2.0, January 2004
-#
use strict;
BEGIN{ if (not $] < 5.006) { require warnings; warnings->import } }
@@ -1,13 +1,4 @@
#!perl
-#
-# This file is part of CPAN-Reporter
-#
-# This software is Copyright (c) 2006 by David Golden.
-#
-# This is free software, licensed under:
-#
-# The Apache License, Version 2.0, January 2004
-#
use strict;
BEGIN{ if (not $] < 5.006) { require warnings; warnings->import } }
@@ -1,13 +1,4 @@
#!perl
-#
-# This file is part of CPAN-Reporter
-#
-# This software is Copyright (c) 2006 by David Golden.
-#
-# This is free software, licensed under:
-#
-# The Apache License, Version 2.0, January 2004
-#
use strict;
BEGIN{ if (not $] < 5.006) { require warnings; warnings->import } }
@@ -1,13 +1,4 @@
#!perl
-#
-# This file is part of CPAN-Reporter
-#
-# This software is Copyright (c) 2006 by David Golden.
-#
-# This is free software, licensed under:
-#
-# The Apache License, Version 2.0, January 2004
-#
use strict;
BEGIN{ if (not $] < 5.006) { require warnings; warnings->import } }
@@ -1,13 +1,4 @@
#!perl
-#
-# This file is part of CPAN-Reporter
-#
-# This software is Copyright (c) 2006 by David Golden.
-#
-# This is free software, licensed under:
-#
-# The Apache License, Version 2.0, January 2004
-#
use strict;
BEGIN{ if (not $] < 5.006) { require warnings; warnings->import } }
@@ -1,13 +1,4 @@
#!perl
-#
-# This file is part of CPAN-Reporter
-#
-# This software is Copyright (c) 2006 by David Golden.
-#
-# This is free software, licensed under:
-#
-# The Apache License, Version 2.0, January 2004
-#
use strict;
BEGIN{ if (not $] < 5.006) { require warnings; warnings->import } }
@@ -1,13 +1,4 @@
#!perl
-#
-# This file is part of CPAN-Reporter
-#
-# This software is Copyright (c) 2006 by David Golden.
-#
-# This is free software, licensed under:
-#
-# The Apache License, Version 2.0, January 2004
-#
use strict;
BEGIN{ if (not $] < 5.006) { require warnings; warnings->import } }
@@ -1,13 +1,4 @@
#!perl
-#
-# This file is part of CPAN-Reporter
-#
-# This software is Copyright (c) 2006 by David Golden.
-#
-# This is free software, licensed under:
-#
-# The Apache License, Version 2.0, January 2004
-#
use strict;
BEGIN{ if (not $] < 5.006) { require warnings; warnings->import } }
@@ -1,13 +1,4 @@
#!perl
-#
-# This file is part of CPAN-Reporter
-#
-# This software is Copyright (c) 2006 by David Golden.
-#
-# This is free software, licensed under:
-#
-# The Apache License, Version 2.0, January 2004
-#
use strict;
BEGIN{ if (not $] < 5.006) { require warnings; warnings->import } }
@@ -1,13 +1,4 @@
#!perl
-#
-# This file is part of CPAN-Reporter
-#
-# This software is Copyright (c) 2006 by David Golden.
-#
-# This is free software, licensed under:
-#
-# The Apache License, Version 2.0, January 2004
-#
use strict;
BEGIN{ if (not $] < 5.006) { require warnings; warnings->import } }
@@ -1,13 +1,4 @@
#!perl
-#
-# This file is part of CPAN-Reporter
-#
-# This software is Copyright (c) 2006 by David Golden.
-#
-# This is free software, licensed under:
-#
-# The Apache License, Version 2.0, January 2004
-#
use strict;
BEGIN{ if (not $] < 5.006) { require warnings; warnings->import } }
@@ -1,13 +1,4 @@
#!perl
-#
-# This file is part of CPAN-Reporter
-#
-# This software is Copyright (c) 2006 by David Golden.
-#
-# This is free software, licensed under:
-#
-# The Apache License, Version 2.0, January 2004
-#
use strict;
BEGIN{ if (not $] < 5.006) { require warnings; warnings->import } }
@@ -1,13 +1,4 @@
#!perl
-#
-# This file is part of CPAN-Reporter
-#
-# This software is Copyright (c) 2006 by David Golden.
-#
-# This is free software, licensed under:
-#
-# The Apache License, Version 2.0, January 2004
-#
use strict;
BEGIN{ if (not $] < 5.006) { require warnings; warnings->import } }
@@ -252,7 +243,7 @@ is( scalar @history, $expected_history_lines,
"history file length is $expected_history_lines"
);
-is( shift @history, "# Generated by CPAN::Reporter $CPAN::Reporter::VERSION\n",
+is( shift @history, "# Generated by CPAN::Reporter $CPAN::Reporter::History::VERSION\n",
"history starts with version comment"
);
@@ -1,13 +1,4 @@
#!perl
-#
-# This file is part of CPAN-Reporter
-#
-# This software is Copyright (c) 2006 by David Golden.
-#
-# This is free software, licensed under:
-#
-# The Apache License, Version 2.0, January 2004
-#
use strict;
BEGIN{ if (not $] < 5.006) { require warnings; warnings->import } }
@@ -40,7 +40,7 @@ my $case = {
},
};
-plan tests => 1 + 4 * (1 + test_fake_config_plan + test_dispatch_plan);
+plan tests => 1 + 3 * (1 + test_fake_config_plan + test_dispatch_plan);
#--------------------------------------------------------------------------#
# tests
@@ -59,15 +59,15 @@ test_dispatch(
will_send => $case->{will_send},
);
-is( Test::Reporter::Mocked->transport(), 'Net::SMTP',
- "by default, transport should be be set to Net::SMTP"
+is( Test::Reporter::Mocked->transport(), 'Metabase',
+ "by default, transport should be be set to Metabase"
);
#--------------------------------------------------------------------------#
# transport set in config
#--------------------------------------------------------------------------#
-for my $transport ( qw/Net::SMTP Mail::Send/ ) {
+for my $transport ( qw/Metabase/ ) {
test_fake_config( %{$case->{options}}, transport => $transport );
@@ -1,13 +1,4 @@
#!perl
-#
-# This file is part of CPAN-Reporter
-#
-# This software is Copyright (c) 2006 by David Golden.
-#
-# This is free software, licensed under:
-#
-# The Apache License, Version 2.0, January 2004
-#
use strict;
BEGIN{ if (not $] < 5.006) { require warnings; warnings->import } }
@@ -1,13 +1,4 @@
#!perl
-#
-# This file is part of CPAN-Reporter
-#
-# This software is Copyright (c) 2006 by David Golden.
-#
-# This is free software, licensed under:
-#
-# The Apache License, Version 2.0, January 2004
-#
use strict;
BEGIN{ if (not $] < 5.006) { require warnings; warnings->import } }
@@ -1,12 +1,3 @@
-#
-# This file is part of CPAN-Reporter
-#
-# This software is Copyright (c) 2006 by David Golden.
-#
-# This is free software, licensed under:
-#
-# The Apache License, Version 2.0, January 2004
-#
package t::Frontend;
use strict;
BEGIN{ if (not $] < 5.006) { require warnings; warnings->import } }
@@ -15,7 +6,11 @@ use ExtUtils::MakeMaker ();
BEGIN {
$INC{"CPAN.pm"} = 1; #fake load
+ $INC{"Test/Reporter/Transport/Metabase.pm"} = 1; #fake load
$CPAN::VERSION = 999;
+ $Test::Reporter::Transport::Metabase::VERSION = 999;
+ $CPAN::Reporter::VERSION ||= 999;
+ $CPAN::Reporter::History::VERSION ||= 999;
}
package CPAN::Shell;
@@ -1,12 +1,3 @@
-#
-# This file is part of CPAN-Reporter
-#
-# This software is Copyright (c) 2006 by David Golden.
-#
-# This is free software, licensed under:
-#
-# The Apache License, Version 2.0, January 2004
-#
package t::Helper;
use strict;
BEGIN{ if (not $] < 5.006) { require warnings; warnings->import } }
@@ -62,7 +53,6 @@ my $config_file = File::Spec->catfile( $config_dir, "config.ini" );
my $bogus_email_from = 'johndoe@example.com';
my $bogus_email_to = 'no_one@example.com';
-my $bogus_smtp = 'mail.mail.com';
my %tool_constants = (
'eumm' => {
@@ -86,7 +76,7 @@ use vars qw/$sent_report @cc_list/;
# test config file prep
#--------------------------------------------------------------------------#
-sub test_fake_config_plan() { 3 }
+sub test_fake_config_plan() { 4 }
sub test_fake_config {
local $Test::Builder::Level = $Test::Builder::Level + 1;
my %overrides = @_;
@@ -98,13 +88,18 @@ sub test_fake_config {
ok( -d $config_dir,
"config directory created"
);
+ my $metabase_file = File::Spec->catfile( $config_dir, 'metabase_id.json' );
+ # 2-args open with bare descriptor to work in older perls
+ open METABASE, ">$metabase_file";
+ close METABASE;
+ ok -r $metabase_file, 'created mock metabase file for testing';
my $tiny = Config::Tiny->new();
$tiny->{_}{email_from} = $bogus_email_from;
$tiny->{_}{email_to} = $bogus_email_to; # failsafe
- $tiny->{_}{smtp_server} = $bogus_smtp;
$tiny->{_}{send_report} = "yes";
$tiny->{_}{send_duplicates} = "yes"; # tests often repeat same stuff
+ $tiny->{_}{transport} = "Metabase uri https://metabase.cpantesters.org/api/v1/ id_file metabase_id.json";
for my $key ( keys %overrides ) {
$tiny->{_}{$key} = $overrides{$key};
}
@@ -792,7 +787,7 @@ sub subject {
my %mocked_data;
-my @valid_transport = qw/Mail::Send Net::SMTP Net::SMTP::Auth HTTP/;
+my @valid_transport = qw/Metabase/;
sub transport {
my ($self) = shift;
@@ -1,12 +1,3 @@
-#
-# This file is part of CPAN-Reporter
-#
-# This software is Copyright (c) 2006 by David Golden.
-#
-# This is free software, licensed under:
-#
-# The Apache License, Version 2.0, January 2004
-#
package t::MockCPANDist;
use strict;
BEGIN { if ( not $] < 5.006 ) { require warnings; warnings->import } }
@@ -1,12 +1,3 @@
-#
-# This file is part of CPAN-Reporter
-#
-# This software is Copyright (c) 2006 by David Golden.
-#
-# This is free software, licensed under:
-#
-# The Apache License, Version 2.0, January 2004
-#
package t::MockHomeDir;
use strict;
BEGIN{ if (not $] < 5.006) { require warnings; warnings->import } }
@@ -1,12 +1,3 @@
-#
-# This file is part of CPAN-Reporter
-#
-# This software is Copyright (c) 2006 by David Golden.
-#
-# This is free software, licensed under:
-#
-# The Apache License, Version 2.0, January 2004
-#
use strict;
print( ($| ? "1" : "0"), "\n" );
@@ -1,12 +1,3 @@
-#
-# This file is part of CPAN-Reporter
-#
-# This software is Copyright (c) 2006 by David Golden.
-#
-# This is free software, licensed under:
-#
-# The Apache License, Version 2.0, January 2004
-#
use strict;
print( ($| ? "1" : "0"), "\n" );
@@ -1,12 +1,3 @@
-#
-# This file is part of CPAN-Reporter
-#
-# This software is Copyright (c) 2006 by David Golden.
-#
-# This is free software, licensed under:
-#
-# The Apache License, Version 2.0, January 2004
-#
use strict;
print( ($| ? "1" : "0"), "\n" );
@@ -1,12 +1,3 @@
-#
-# This file is part of CPAN-Reporter
-#
-# This software is Copyright (c) 2006 by David Golden.
-#
-# This is free software, licensed under:
-#
-# The Apache License, Version 2.0, January 2004
-#
use strict;
print( ($| ? "1" : "0"), "\n" );
@@ -1,12 +1,3 @@
-#
-# This file is part of CPAN-Reporter
-#
-# This software is Copyright (c) 2006 by David Golden.
-#
-# This is free software, licensed under:
-#
-# The Apache License, Version 2.0, January 2004
-#
package Bogus::Broken;
$VERSION = 3.14;
use strict;
@@ -1,12 +1,3 @@
-#
-# This file is part of CPAN-Reporter
-#
-# This software is Copyright (c) 2006 by David Golden.
-#
-# This is free software, licensed under:
-#
-# The Apache License, Version 2.0, January 2004
-#
package Bogus::Complex;
$VERSION = 3.14;
use strict;
@@ -1,12 +1,3 @@
-#
-# This file is part of CPAN-Reporter
-#
-# This software is Copyright (c) 2006 by David Golden.
-#
-# This is free software, licensed under:
-#
-# The Apache License, Version 2.0, January 2004
-#
package Bogus::Conflict;
$VERSION = 3.14;
use strict;
@@ -1,12 +1,3 @@
-#
-# This file is part of CPAN-Reporter
-#
-# This software is Copyright (c) 2006 by David Golden.
-#
-# This is free software, licensed under:
-#
-# The Apache License, Version 2.0, January 2004
-#
package Bogus::Found;
$VERSION = 3.14;
use strict;
@@ -1,12 +1,3 @@
-#
-# This file is part of CPAN-Reporter
-#
-# This software is Copyright (c) 2006 by David Golden.
-#
-# This is free software, licensed under:
-#
-# The Apache License, Version 2.0, January 2004
-#
package Bogus::GT;
$VERSION = 3.14;
use strict;
@@ -1,12 +1,3 @@
-#
-# This file is part of CPAN-Reporter
-#
-# This software is Copyright (c) 2006 by David Golden.
-#
-# This is free software, licensed under:
-#
-# The Apache License, Version 2.0, January 2004
-#
package Bogus::GTE;
$VERSION = 3.14;
use strict;
@@ -1,12 +1,3 @@
-#
-# This file is part of CPAN-Reporter
-#
-# This software is Copyright (c) 2006 by David Golden.
-#
-# This is free software, licensed under:
-#
-# The Apache License, Version 2.0, January 2004
-#
package Bogus::LT;
$VERSION = 3.14;
use strict;
@@ -1,12 +1,3 @@
-#
-# This file is part of CPAN-Reporter
-#
-# This software is Copyright (c) 2006 by David Golden.
-#
-# This is free software, licensed under:
-#
-# The Apache License, Version 2.0, January 2004
-#
package Bogus::LTE;
$VERSION = 3.14;
use strict;
@@ -1,12 +1,3 @@
-#
-# This file is part of CPAN-Reporter
-#
-# This software is Copyright (c) 2006 by David Golden.
-#
-# This is free software, licensed under:
-#
-# The Apache License, Version 2.0, January 2004
-#
package Bogus::NoVersion;
use strict;
1;
@@ -1,12 +1,3 @@
-#
-# This file is part of CPAN-Reporter
-#
-# This software is Copyright (c) 2006 by David Golden.
-#
-# This is free software, licensed under:
-#
-# The Apache License, Version 2.0, January 2004
-#
package Bogus::Shadow;
$VERSION = 3.14;
use strict;
@@ -1,12 +1,3 @@
-#
-# This file is part of CPAN-Reporter
-#
-# This software is Copyright (c) 2006 by David Golden.
-#
-# This is free software, licensed under:
-#
-# The Apache License, Version 2.0, January 2004
-#
package Bogus::TooOld;
$VERSION = 0.01;
use strict;
@@ -1,12 +1,3 @@
-#
-# This file is part of CPAN-Reporter
-#
-# This software is Copyright (c) 2006 by David Golden.
-#
-# This is free software, licensed under:
-#
-# The Apache License, Version 2.0, January 2004
-#
package Bogus::Shadow;
$VERSION = 2.72;
use strict;
@@ -1,13 +1,4 @@
#!perl
-#
-# This file is part of CPAN-Reporter
-#
-# This software is Copyright (c) 2006 by David Golden.
-#
-# This is free software, licensed under:
-#
-# The Apache License, Version 2.0, January 2004
-#
use Test::More;
@@ -1,13 +1,4 @@
#!perl
-#
-# This file is part of CPAN-Reporter
-#
-# This software is Copyright (c) 2006 by David Golden.
-#
-# This is free software, licensed under:
-#
-# The Apache License, Version 2.0, January 2004
-#
use Test::More;
@@ -1,13 +1,4 @@
#!perl
-#
-# This file is part of CPAN-Reporter
-#
-# This software is Copyright (c) 2006 by David Golden.
-#
-# This is free software, licensed under:
-#
-# The Apache License, Version 2.0, January 2004
-#
use Test::More;
eval "use Test::Pod 1.41";
@@ -1,13 +1,4 @@
#!perl
-#
-# This file is part of CPAN-Reporter
-#
-# This software is Copyright (c) 2006 by David Golden.
-#
-# This is free software, licensed under:
-#
-# The Apache License, Version 2.0, January 2004
-#
use Test::More;
@@ -0,0 +1,12 @@
+#!/usr/bin/perl
+use 5.006;
+use strict;
+use warnings;
+use Test::More;
+
+eval "use Test::Version 0.04";
+plan skip_all => "Test::Version 0.04 required for testing versions"
+ if $@;
+
+version_all_ok();
+done_testing;